export default{
	common:{
		baseUrl:'http://43.142.102.167:8088',
		baseUrl2:"http://shopappmgt.yy12365.com",
		data:{},
		header:{
			"Content-Type1":"application/json",
			"Content-Type2":"application/x-www-form-urlencoded"	
		},
		method:'GET',
		dataType:'json'
	},
	request(options = {}){
		options.url = this.common.baseUrl + options.url;
		options.data = options.data || this.common.data;
		options.header = options.header || this.common.header;
		options.dataType = options.dataType || this.common.dataType;
		return new Promise((resolve,reject)=>{
			uni.request({
				...options,
				success:(res)=>{
					if (res.data.status != 200){
						return uni.showToast({
							title:'获取数据失败'
						})
					}
					resolve(res.data)
				},
				fail:(err)=>{
					uni.showToast({
						title:'请求接口失败'
					})
					reject(err)
				}
			})
			
		})
	}
}